package com.lzy.cloud.order.service.impl;

import com.lzy.cloud.order.dtos.OrderInfoDetailDto;
import com.lzy.cloud.order.entity.OrderInfoDetail;
import com.lzy.cloud.order.mapper.OrderInfoDetailMapperExt;
import com.lzy.cloud.order.service.OrderInfoDetailService;
import com.lzy.framework.core.utils.DozerUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 订单总表附属表
 * Created by WIN7 on 2018/6/6.
 */
@Service
public class OrderInfoDetailServiceImpl implements OrderInfoDetailService {

    @Autowired
    private OrderInfoDetailMapperExt orderInfoDetailMapperExt;

    @Override
    public OrderInfoDetailDto find(String orderId) {
        return orderInfoDetailMapperExt.queryByOrderId(orderId);
    }

    @Override
    public boolean create(OrderInfoDetailDto orderInfoDetailDto) {
        return orderInfoDetailMapperExt.insertSelective(DozerUtils.map(orderInfoDetailDto,OrderInfoDetail.class)) > 0;
    }

    @Override
    public boolean update(OrderInfoDetailDto orderInfoDetailDto) {
        return orderInfoDetailMapperExt.updateByPrimaryKeySelective(DozerUtils.map(orderInfoDetailDto,OrderInfoDetail.class))>0;
    }
}
